<?php
namespace app\home\controller;
use app\common\controller\HomeBase;
use app\admin\model\SendSms;
use think\request;
use think\Db;
class Test extends HomeBase
{
	//阿里大于短信测试
	public function alidayuSms()
	{
		$sms = new SendSms();
		$phone = "13372510395";
		//读取数据库配置
		$sms_config = Db::name('sms_config')->where('status',1)->field('appid,appsecret,smsid,sign')->find();

		$result = $sms->sendSms($sms_config['appid'],$sms_config['appsecret'],$phone,$sms_config['sign'],$sms_config['smsid']);
		//根据返回值判断返回类型
		if($result->message && $result->message == 'OK'){
			return json_encode(['status'=>1,'msg'=>'发送成功']);
		}else{
			dump($result);die;
			return json_encode(['status'=>0,'msg'=>$result->message]);
		}
	}

}